//
//  FirstViewController.m
//  homework_UInavigationController
//
//  Created by dllo on 16/6/14.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "FirstViewController.h"
#import "MyScrollView.h"


@interface FirstViewController ()

@property (nonatomic, retain) MyScrollView *scrollView;

@end

@implementation FirstViewController

-(void)dealloc
{
    [_scrollView release];
    [super dealloc];
}

-(BOOL)prefersStatusBarHidden
{
    return YES;
}

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    [self configNavigationItem];
    
    [self configNavigationBar];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self createScrollView];
    
}

//
-(void)createScrollView
{
    self.scrollView = [[MyScrollView alloc]initWithFrame:self.view.frame];
    
    [self.view addSubview:self.scrollView];
    
    self.scrollView.center = self.view.center;
    
    self.scrollView.backgroundColor = [UIColor lightGrayColor];
    
    [self.scrollView release];
    
    UIImage *image1 = [UIImage imageNamed:@"football.png"];
    UIImage *image2 = [UIImage imageNamed:@"moon.png"];
    UIImage *image3 = [UIImage imageNamed:@"sun.png"];
    UIImage *image4 = [UIImage imageNamed:@"basketball.png"];
    UIImage *image5 = [UIImage imageNamed:@"baseball.png"];
    UIImage *image6 = [UIImage imageNamed:@"star.png"];
    
    NSArray *array = @[image1, image2, image3, image4, image5, image6];
    
    [self.scrollView addPicture:array];
    
    
}

/**视图将要出现*/
-(void)viewWillAppear:(BOOL)animated
{
//    NSLog(@"%ld",self.tag);
    self.scrollView.contentOffset = CGPointMake(self.view.frame.size.width * (self.tag - 1), 0);
   
}


-(void)configNavigationBar
{
    self.navigationController.navigationBar.barTintColor = [UIColor orangeColor];
}

-(void)configNavigationItem
{
    self.navigationItem.title = @"第二页";
}




@end











